﻿<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<script
		src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB425wKAGlAQ323sMqenZ5Pc7ErmlcTspM&amp;sensor=false&amp;libraries=drawing"
		type="text/javascript" />
</h:head>

<h:body>
	<p:scrollPanel mode="native" style="width:100%;height:100%;">
		<h:form id="form">
			<p:growl id="growl" life="3000" />
			<p:dataTable id="tblLogradouros" var="logra"
				value="#{logradouroBean.logradouros}" paginator="true" rows="10"
				style="margin-bottom:20px" rowsPerPageTemplate="5,10,15"
				emptyMessage="Nenhum logradouro cadastrado.">

				<f:facet name="header">
 		 			Lista de logradouros
   				</f:facet>

				<p:column headerText="Título" filterBy="#{logra.nomeLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.nomeLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText required="true" value="#{logra.nomeLogradouro}"
								requiredMessage="Título do logradouro não informado!"
								style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<!-- 
				<p:column headerText="Bairro">
				</p:column>
				 -->
				<!-- 
				<p:column headerText="Faces de quadra">
				</p:column>
				 -->
				<p:column headerText="Tipo" filterBy="#{logra.tipoLogradouro}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.tipoLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:selectOneMenu value="#{logra.tipoLogradouro}"
								style="width:100%">
								<f:selectItem itemLabel="ALT" itemValue="ALT" />
					﻿  ﻿  ﻿              			<f:selectItem itemLabel="AV" itemValue="AV" />
					﻿  ﻿  ﻿              			<f:selectItem itemLabel="BEC"
									itemValue="BEC" />
								<f:selectItem itemLabel="C" itemValue="C" />
								<f:selectItem itemLabel="CAN" itemValue="CAN" />
								<f:selectItem itemLabel="COR" itemValue="COR" />
								<f:selectItem itemLabel="LAD" itemValue="LAD" />
								<f:selectItem itemLabel="LGO" itemValue="LGO" />
								<f:selectItem itemLabel="MOR" itemValue="MOR" />
								<f:selectItem itemLabel="PR" itemValue="PR" />
								<f:selectItem itemLabel="PTE" itemValue="PTE" />
								<f:selectItem itemLabel="PAT" itemValue="PAT" />
								<f:selectItem itemLabel="PRC" itemValue="PRC" />
								<f:selectItem itemLabel="PRQ" itemValue="PRQ" />
								<f:selectItem itemLabel="RUA" itemValue="RUA" />
								<f:selectItem itemLabel="ROD" itemValue="ROD" />
								<f:selectItem itemLabel="SUB" itemValue="SUB" />
								<f:selectItem itemLabel="1SB" itemValue="1SB" />
								<f:selectItem itemLabel="2SB" itemValue="2SB" />
								<f:selectItem itemLabel="3SB" itemValue="3SB" />
								<f:selectItem itemLabel="4SB" itemValue="4SB" />
								<f:selectItem itemLabel="5SB" itemValue="5SB" />
								<f:selectItem itemLabel="6SB" itemValue="6SB" />
								<f:selectItem itemLabel="7SB" itemValue="7SB" />
								<f:selectItem itemLabel="TRV" itemValue="TRV" />
								<f:selectItem itemLabel="1TR" itemValue="1TR" />
								<f:selectItem itemLabel="2TR" itemValue="2TR" />
								<f:selectItem itemLabel="3TR" itemValue="3TR" />
								<f:selectItem itemLabel="4TR" itemValue="4TR" />
								<f:selectItem itemLabel="5TR" itemValue="5TR" />
								<f:selectItem itemLabel="6TR" itemValue="6TR" />
								<f:selectItem itemLabel="7TR" itemValue="7TR" />
								<f:selectItem itemLabel="8TR" itemValue="8TR" />
								<f:selectItem itemLabel="9TR" itemValue="9TR" />
								<f:selectItem itemLabel="10T" itemValue="10t" />
								<f:selectItem itemLabel="ENT" itemValue="ENT" />
								<f:selectItem itemLabel="ESC" itemValue="ESC" />
								<f:selectItem itemLabel="EST" itemValue="EST" />
								<f:selectItem itemLabel="ILH" itemValue="ILH" />
								<f:selectItem itemLabel="JAR" itemValue="JAR" />
							</p:selectOneMenu>
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Origem" filterBy="#{logra.origemLogradouro}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.origemLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:selectOneMenu style="width:100%"
								value="#{logra.origemLogradouro}">
							﻿  ﻿  ﻿          	<f:selectItem itemLabel="LEI" itemValue="LEI" />
								<f:selectItem itemLabel="ATO" itemValue="ATO" />
								<f:selectItem itemLabel="DECRETO" itemValue="DECRETO" />
	﻿  ﻿  ﻿      							</p:selectOneMenu>
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Código de origem"
					filterBy="#{logra.codigoOrigemLogradouro}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.codigoOrigemLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="999999/99" required="true"
								requiredMessage="Código de origem do logradouro não informado!"
								value="#{logra.codigoOrigemLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Ano de publicação"
					filterBy="#{logra.anoPublicOrigemLogradouro}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.anoPublicOrigemLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="9999" required="true"
								requiredMessage="Ano de publicação da origem não informado!"
								value="#{logra.anoPublicOrigemLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Ano de criação"
					filterBy="#{logra.anoCriacaoLogradouro}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.anoCriacaoLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask required="true" mask="9999"
								requiredMessage="Ano de criação do logradouro não informado!"
								value="#{logra.anoCriacaoLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Mapa" width="6%">
					<p:commandLink oncomplete="PF('mapaDlg').show()"
						update=":form:mapa">
						<h:outputText styleClass="ui-icon ui-icon-image"
							style="margin:0 auto;" />
						<f:setPropertyActionListener value="#{logra}"
							target="#{logradouroBean.logradouro}" for="mapaDlg" />
					</p:commandLink>
				</p:column>

				<f:facet name="footer">
   					Número de logradouros: #{logradouroBean.numeroLogradourosCadastrados()}.
				</f:facet>

			</p:dataTable>

			<h3>Exportar</h3>
			<h:commandLink>
				<p:graphicImage url="imagens/excel.png" width="24" />
				<p:dataExporter type="xls" target="tblLogradouros" fileName="logras"
					pageOnly="true" />
			</h:commandLink>

			<h:commandLink>
				<p:graphicImage url="imagens/pdf.png" width="24" />
				<p:dataExporter type="pdf" target="tblLogradouros" fileName="logras"
					pageOnly="true" />
			</h:commandLink>

			<p:dialog widgetVar="mapaDlg" width="670" height="500"
				showEffect="clip" hideEffect="clip" maximizable="false"
				closeOnEscape="true">
				<p:outputPanel id="mapa">
					<h:graphicImage url="#{logradouroBean.logradouro.url}" />
				</p:outputPanel>
			</p:dialog>
		</h:form>
	</p:scrollPanel>
</h:body>
</html>